#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableHeroAssistDao:DaoBase<TableHeroAssist>
    {
        public override string GetFileName()
        {
            return "TableHeroAssist.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableHeroAssist>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableHeroAssist model)
        {
            if (!cacheOneIndex.ContainsKey(model.heroId.ToString()))
            {
                cacheOneIndex[model.heroId.ToString()] = new List<TableHeroAssist>();
            }
            cacheOneIndex[model.heroId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableHeroAssist model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.id)) UnityEngine.Debug.LogError("数据表id重复:TableHeroAssist->id: " + model.id);
            #endif
            cachePrimaryInt[model.id] = model;
        }
        protected override TableHeroAssist ParseRowData(string[] rowData)
        {
            TableHeroAssist data = new TableHeroAssist();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.id = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.heroId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.orderNum = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.unlockCondition = rowData[3];
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.isOpen = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.propAdd = rowData[5];
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.propAddPercent = rowData[6];
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.fightBuffId = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.skillId = int.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.descIndex = rowData[9];
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.descIcon = rowData[10];
            }
            return data;
        }
    }
}
